package com.karst.webnotes.chapter04
{
	import flash.events.Event;
	
	import org.aswing.AsWingManager;
	// Flash IDE 专用
	import org.papervision3d.materials.BitmapAssetMaterial;
	import org.papervision3d.objects.primitives.Plane;
	import org.papervision3d.view.BasicView;
	
	internal class BmpAssetMaterialExample extends BasicView
	{
		public function BmpAssetMaterialExample()
		{
			super() ;
			AsWingManager.getStage().frameRate = 12 ;
			createView() ;
			startRendering() ;
		}

		private var material : BitmapAssetMaterial = null ;
		private var plane : Plane = null ;
		private function createView() : void
		{
			if( material == null )
				material = new BitmapAssetMaterial( "asset" ) ;
			
			if( plane == null )
				plane = new Plane( material, 400, 400, 2, 2 ) ;
			
			scene.addChild( plane ) ;
		}
		
		override protected function onRenderTick(event:Event=null):void
		{
			super.onRenderTick() ;
			if( plane )
				plane.localRotationY++ ;
		}
	}
}